package com.kinon.market.tools;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;

public class MyFragmentReplace {

    public static void fragmentReplace(FragmentActivity activity, int view,
                                       Fragment fragment) {
        FragmentManager fManager = activity.getSupportFragmentManager();
        FragmentTransaction transaction = fManager.beginTransaction();
        transaction.replace(view, fragment);
        transaction.commit();
    }

    public static void fragmentBundleReplace(FragmentActivity activity,
                                             int view, Bundle bundle, Fragment fragment) {
        FragmentManager fManager = activity.getSupportFragmentManager();
        FragmentTransaction transaction = fManager.beginTransaction();
        fragment.setArguments(bundle);
        transaction.replace(view, fragment);
        transaction.commit();

    }

}
